libxl: adjust point of backend name resolution
authorEric Shelton <eshelton@pobox.com>
Tue, 30 Apr 2013 15:03:03 +0000 (11:03 -0400)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 1 May 2013 11:52:37 +0000 (12:52 +0100)
commit1612897f484ebb886b6bd143a0d55331370c28aa
tree8f3b4e843afe09a2ec2b2b2a50e4d7b84e4f7729
parent6aaee4960d8a56aeab9d962ce554dff7f987e1fd
libxl: adjust point of backend name resolution

Resolution of a backend name to a domid needs to happen a little earlier
in some cases.

For example, if a domU is specified as a backend for a
disk and, as previously written, libxl__device_disk_setdefault() calls
libxl__resolve_domid() last, then disk->backend_domid still equals
LIBXL_TOOLSTACK_DOMID when libxl__device_disk_set_backend() is called.
This results in libxl__device_disk_set_backend() making an incorrect
attempt to validate the target by calling stat() on a file on dom0,
resulting in ERROR_INVAL (see libxl_device.c lines 239-248), which
prevents creation of the frontend domain.

Likewise, libxl__device_nic_setdefault() previously made use of
nic->backend_domid before it was set.

Signed-off-by: Eric Shelton <eshelton@pobox.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
tools/libxl/libxl.c